//
//  ImageDownloader.h
//  豆瓣
//
//  Created by 李佳骏 on 15/7/1.
//  Copyright (c) 2015年 J.Lee. All rights reserved.
//

#import <Foundation/Foundation.h>

@protocol ImageDownloadFinishDelegate <NSObject>

- (void)imageDownloadSuccess:(NSData *)data;

- (void)imageDownloadError:(NSError *)error;

@end

typedef void (^imageDownloadSuccess) (NSData *data);
typedef void (^imageDownloadError) (NSError *error);

@interface ImageDownloader : NSObject

@property (nonatomic, copy)imageDownloadSuccess successBlock;
@property (nonatomic, copy)imageDownloadError errorBlock;

@property (nonatomic, assign)id<ImageDownloadFinishDelegate> delegate;

- (void)requestImageURLString:(NSString *)imageURLString
                 successBlock:(imageDownloadSuccess)successBlock
                   errorBolck:(imageDownloadError)errorBlock;

- (void)requestImageURLString:(NSString *)imageURLString andDelegate:(id<ImageDownloadFinishDelegate>)delegate;


@end
